home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / music_utilities / pt013.dms / pt013.adf / Programmers / MODPlayer / reloc.a < prev    next >
Text File  |  1991-08-25  |  2KB  |  90 lines

  1. ; Small reloc routine for those who include the module directly in
  2. ; the program code.
  3.  
  4. ; NOTE: THE MODULE POINTER IS PASSED IN STACK, SO THIS IS COMPATIBLE
  5. ;       WITH C-PROGRAMS.
  6.  
  7.     section    "text",code
  8.  
  9.     xdef    _RelocModule
  10.  
  11. reloci    move.l    24(a2),d0
  12.     beq.s    xloci
  13.     movea.l    d0,a0
  14.     moveq   #0,d0
  15.     move.b  787(a1),d0    ;number of samples
  16.     subq.b  #1,d0
  17. relocs:    bsr.s   relocentr
  18.     move.l    -4(a0),d3    ;sample ptr
  19.     beq.s    nosyn
  20.     move.l    d3,a3
  21.     tst.w    4(a3)
  22.     bpl.s    nosyn        ;type >= 0
  23.     move.w    20(a3),d2    ;number of waveforms
  24.     lea    278(a3),a3    ;ptr to wf ptrs
  25.     subq.w    #1,d2
  26. relsyn:    add.l    d3,(a3)+
  27.     dbf    d2,relsyn
  28. nosyn:    dbf     d0,relocs
  29. xloci    rts
  30. norel    addq.l    #4,a0
  31.     rts
  32. relocentr:
  33.     tst.l   (a0)
  34.     beq.s   norel
  35.     add.l   d1,(a0)+
  36.     rts
  37. _RelocModule:
  38.     move.l    4(sp),a0    ;get module pointer from stack
  39.     movem.l    a2-a3/d2-d3,-(sp)
  40.     movea.l a0,a2
  41.     move.l  a2,d1        ;d1 = ptr to start of module
  42.     bsr.s    relocp
  43.     movea.l 8(a2),a1
  44.     bsr.s    reloci
  45. rel_lp    bsr.s    relocb
  46.     move.l    32(a2),d0    ;extension struct
  47.     beq.s    rel_ex
  48.     move.l    d0,a0
  49.     bsr.s    relocentr    ;ptr to next module
  50.     bsr.s    relocentr    ;InstrExt...
  51.     addq.l    #4,a0        ;skip sizes of InstrExt
  52. ; We reloc the pointers of MMD0exp, so anybody who needs them can easily
  53. ; read them.
  54.     bsr.s    relocentr    ;annotxt
  55.     addq.l    #4,a0        ;annolen
  56.     bsr.s    relocentr    ;InstrInfo
  57.     addq.l    #8,a0
  58.     bsr.s    relocentr    ;rgbtable (not useful for most people)
  59.     addq.l    #4,a0        ;skip channelsplit
  60.     bsr.s    relocentr    ;NotationInfo
  61.     move.l    d0,a0
  62.     move.l    (a0),d0
  63.     beq.s    rel_ex
  64.     move.l    d0,a2
  65.     bsr.s    relocp
  66.     movea.l 8(a2),a1
  67.     bra.s    rel_lp
  68. rel_ex    movem.l    (sp)+,d2-d3/a2-a3
  69.     rts
  70.  
  71. relocb    move.l    16(a2),d0
  72.     beq.s    xlocb
  73.     movea.l    d0,a0
  74.     move.w  504(a1),d0
  75.     subq.b  #1,d0
  76. rebl    bsr.s   relocentr
  77.     dbf     d0,rebl
  78. xlocb    rts
  79.  
  80. relocp    lea    8(a2),a0
  81.     bsr.s    relocentr
  82.     addq.l    #4,a0
  83.     bsr.s    relocentr
  84.     addq.l    #4,a0
  85.     bsr.s    relocentr
  86.     addq.l    #4,a0
  87.     bra.s    relocentr
  88.  
  89.     end
  90.